﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HostpitalManage.GUI
{
    public partial class AddPatients : Form
    {
        public AddPatients()
        {
            InitializeComponent();
        }

        private void btAddBN_Click(object sender, EventArgs e)
        {
            addNewPatient();
        }

        public void addNewPatient()
        {
            DAO.Connection connection = new DAO.Connection();
            String id = txtID.Text;
            String name = txtFullnameBn.Text;
            DateTime birth = dtDateBN.Value;
            String address = txtAddress.Text;
            int phone = Convert.ToInt32(txtPhone.Text);
            String job = txtJob.Text;
            int gender = 0;
            if (rdBoyBn.Checked)
            {
                gender = 1;
            }
            if (rdGirlBn.Checked)
            {
                gender = 0;
            }
            connection.AddPatient(id, name, birth, address, gender, phone, job);
        }

        private void AddPatients_Load(object sender, EventArgs e)
        {

        }
    }
}
